package com.zby.business.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.zby.business.R;

import java.util.List;

/**
 * Created by BY on 2015/12/28.
 */
public class SearchListViewAdapter extends BaseAdapter {
    private List data;
    private LayoutInflater layoutInflater;

    public SearchListViewAdapter(List data, Context context) {
        this.data = data;
        layoutInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = layoutInflater.inflate(R.layout.search_record, null);
        TextView textView = (TextView) convertView.findViewById(R.id.textView);
        textView.setText((String) data.get(position));
        return convertView;
    }
}
